-- Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
--
-- this file licensed under the Mulan PSL v2.
-- You can use this software according to the terms and conditions of the Mulan PSL v2.
-- You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2
--
-- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
-- PURPOSE.
-- See the Mulan PSL v2 for more details.
--
-- Author: auto generate
-- Create: 2025-5-7
-- Description: DO NOT EDIT; Code generated by "service.lua.mako"
local mdb = require 'mc.mdb'
local class = require 'mc.class'
local app_base = require 'mc.service_app_base'
local object_manage = require 'mc.mdb.object_manage'

local LocalTypes = require 'active_standby_mgmt.json_types.Local'
local StatusTypes = require 'active_standby_mgmt.json_types.Status'
local PropertiesTypes = require 'active_standby_mgmt.json_types.Properties'
local RemoteTypes = require 'active_standby_mgmt.json_types.Remote'
local SwitchRuleTypes = require 'active_standby_mgmt.json_types.SwitchRule'

local ActiveStandbyLocal = mdb.register_object('/bmc/kepler/Managers/:ManagerId/ActiveStandby/Local', {
    {name = 'bmc.kepler.Managers.ActiveStandby.Local', interface = LocalTypes.interface},
    {name = 'bmc.kepler.Managers.ActiveStandby.Status', interface = StatusTypes.interface},
    {name = 'bmc.kepler.Object.Properties', interface = PropertiesTypes.interface}
})

function ActiveStandbyLocal:ctor(ManagerId)
    self.path = '/bmc/kepler/Managers/' .. ManagerId .. '/ActiveStandby/Local'
end

local ActiveStandbyRemote = mdb.register_object('/bmc/kepler/Managers/:ManagerId/ActiveStandby/Remotes/:Id', {
    {name = 'bmc.kepler.Managers.ActiveStandby.Remote', interface = RemoteTypes.interface},
    {name = 'bmc.kepler.Managers.ActiveStandby.Status', interface = StatusTypes.interface},
    {name = 'bmc.kepler.Object.Properties', interface = PropertiesTypes.interface}
})

function ActiveStandbyRemote:ctor(ManagerId, Id)
    self.path = '/bmc/kepler/Managers/' .. ManagerId .. '/ActiveStandby/Remotes/' .. Id
end

local SwitchRule = mdb.register_object('/bmc/kepler/Managers/:ManagerId/ActiveStandby/SwitchRules/:Id', {
    {name = 'bmc.kepler.Managers.ActiveStandby.SwitchRule', interface = SwitchRuleTypes.interface},
    {name = 'bmc.kepler.Object.Properties', interface = PropertiesTypes.interface}
})

function SwitchRule:ctor(ManagerId, Id)
    self.path = '/bmc/kepler/Managers/' .. ManagerId .. '/ActiveStandby/SwitchRules/' .. Id
end

local model = require 'class.model'

local active_standby_mgmt_service = class(app_base.Service)

active_standby_mgmt_service.package = 'active_standby_mgmt'

function active_standby_mgmt_service:CreateActiveStandbyLocal(ManagerId, prop_setting_cb)
    local path = '/bmc/kepler/Managers/' .. ManagerId .. '/ActiveStandby/Local'
    return object_manage.create_object('ActiveStandbyLocal', path, path, prop_setting_cb)
end

function active_standby_mgmt_service:CreateActiveStandbyRemote(ManagerId, Id, prop_setting_cb)
    local path = '/bmc/kepler/Managers/' .. ManagerId .. '/ActiveStandby/Remotes/' .. Id
    return object_manage.create_object('ActiveStandbyRemote', path, path, prop_setting_cb)
end

function active_standby_mgmt_service:CreateSwitchRule(ManagerId, Id, prop_setting_cb)
    local path = '/bmc/kepler/Managers/' .. ManagerId .. '/ActiveStandby/SwitchRules/' .. Id
    return object_manage.create_object('SwitchRule', path, path, prop_setting_cb)
end

function active_standby_mgmt_service:ImplActiveStandbyLocalLocalSwitchStatus(cb)
    model.ImplActiveStandbyLocalLocalSwitchStatus(cb)
end

function active_standby_mgmt_service:get_bus()
    return self.bus
end

function active_standby_mgmt_service:ctor()
    self.signal_slots = {}
    self.name = self.name or active_standby_mgmt_service.package

    self.bus:request_name(app_base.Service.get_service_name(self.name))
    model.init(self.bus)
    active_standby_mgmt_service.bus = self.bus
end

function active_standby_mgmt_service:pre_init()
    active_standby_mgmt_service.super.pre_init(self)
end

function active_standby_mgmt_service:init()
    active_standby_mgmt_service.super.init(self)
end

return active_standby_mgmt_service
